package pages;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import utils.BaseAction;

public class RegisterPage {
	private AndroidDriver<AndroidElement> driver;
	private BaseAction action;
	
	public RegisterPage(AndroidDriver<AndroidElement> driver) {
		this.driver = driver;
		this.action = new BaseAction(driver);
	}
	public AndroidElement btn_resigter() {
		return driver.findElementById("com.lyc.cashbook:id/register");
	}
	public AndroidElement edit_account() {
		return driver.findElementById("com.lyc.cashbook:id/et_account");
	}
	public AndroidElement edit_password() {
		return driver.findElementById("com.lyc.cashbook:id/et_psw");
	}
	public AndroidElement edit_passwordA() {
		return driver.findElementById("com.lyc.cashbook:id/et_psw_again");
	}
	public AndroidElement btn_back() {
		return driver.findElementById("com.lyc.cashbook:id/back");
	}
	public void register(String username,String password,String passwordA) throws InterruptedException {
		action.click(btn_resigter());
		action.type(edit_account(),username);
		action.type(edit_password(),password);
		action.type(edit_passwordA(),passwordA);
		action.click(btn_resigter());
		action.click(btn_back());
	}
	
}
